import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-07-20
 * Time: 15:03
 */
public class Test73 {

    public static int[] dailyTemperatures(int[] temperatures) {
        Stack<Integer> st = new Stack<>();
        int n = temperatures.length;
        int[] ret = new int[n];
        // 找左边最大的第一个元素
        for(int i = 0; i < n; i++) {
            while(!st.isEmpty() && temperatures[st.peek()] < temperatures[i]) {
                ret[st.peek()] = i-st.peek();
                st.pop();
            }
            st.push(i);
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] temp = new int[n];
        for(int i = 0; i < n; i++) {
            temp[i] = sc.nextInt();
        }
        int[] ret = dailyTemperatures(temp);
        System.out.println(Arrays.toString(ret));
    }
}
